# 测试websocket 接口
import websocket
import json


def login(data):
    url = 'ws://localhost:8001'
    ws = websocket.create_connection(url)

    data = json.dumps(data)
    ws.send(data)
    print(json.loads(ws.recv()))


if __name__ == '__main__':
    data = ['text', {"cmd": "connect", "args": {"playername": "admin999", "password": "cqc123123"}}, {}]
    login(data)
